-
Notifications
You must be signed in to change notification settings - Fork 327
Allow custom view.Meters to export metrics for other Resources #1212
Allow custom view.Meters to export metrics for other Resources #1212
Conversation
…ensus-instrumentation#1210) Time is already recorded on the client side and stored in the currently unused recordReq.t field. Avoiding these repeated calls to time.Now while the worker is blocked can significantly reduce worker contention.
We need a minor fix for stackdriver though. |
I'm wondering if we can leverage https://github.com/census-instrumentation/opencensus-go/blob/master/resource/resource.go#L146 |
Alternatively, we could do the conversion on the recording side for Stackdriver in Knative, and retire the use of |
@@ -619,3 +641,20 @@ func restart() { | |||
defaultWorker = NewMeter().(*worker) | |||
go defaultWorker.start() | |||
} | |||
|
|||
// byTag implements sort.Interface for *metricdata.TimeSeries by Labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/byTag/byLabel/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, done.
0fedf7a
to
30ad700
Compare
Working with #1196, I discovered that
metricexport.Reader
collects metrics from all registered Producers, but doesn't provide a way to distinguish between different Meters. (WithRegisterExporter
, I can hand off a different exporter for each Meter and curry the Resource that way.)This fills in the existing
metricdata.Resource
field when available, which looks like it should already work with Stackdriver. Prometheus seems to ignore the Resource field; I can send a PR for that if desired.